load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary")
load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")

oncall("fboss_optics_phy")

cpp_library(
    name = "led_core",
    srcs = [
        "LedService.cpp",
        "LedServiceHandler.cpp",
    ],
    headers = [
        "LedService.h",
        "LedServiceHandler.h",
    ],
    exported_deps = [
        ":led_manager",
        "//common/fb303/cpp:fb303",
        "//fboss/led_service/if:led_service-cpp2-services",
        "//folly/futures:core",
    ],
    exported_external_deps = [
        "gflags",
    ],
)

cpp_library(
    name = "led_utils",
    srcs = [
        "LedUtils.cpp",
    ],
    exported_deps = [
        ":led-config",
        "//fboss/agent:fboss-error",
        "//fboss/led_service/if:led_structs-cpp2-types",
        "//folly/logging:logging",
    ],
    exported_external_deps = [
        "gflags",
    ],
)

cpp_library(
    name = "led_manager",
    srcs = [
        "BspLedManager.cpp",
        "FsdbSwitchStateSubscriber.cpp",
        "Icecube800bcLedManager.cpp",
        "Icetea800bcLedManager.cpp",
        "Janga800bicLedManager.cpp",
        "Ladakh800bclsLedManager.cpp",
        "LedManager.cpp",
        "LedManagerInit.cpp",
        "Meru800bfaLedManager.cpp",
        "Meru800biaLedManager.cpp",
        "Minipack3NLedManager.cpp",
        "MinipackBaseLedManager.cpp",
        "MontblancLedManager.cpp",
        "Morgan800ccLedManager.cpp",
        "Tahan800bcLedManager.cpp",
        "Tahansb800bcLedManager.cpp",
        "Wedge800BACTLedManager.cpp",
        "facebook/DarwinLedManager.cpp",
        "facebook/ElbertLedManager.cpp",
        "facebook/FsdbSwitchStateSubscriber.cpp",
        "facebook/FujiLedManager.cpp",
        "facebook/MinipackLedManager.cpp",
        "facebook/Wedge400BaseLedManager.cpp",
        "facebook/Wedge400CLedManager.cpp",
        "facebook/Wedge400LedManager.cpp",
        "facebook/YampLedManager.cpp",
    ],
    headers = [
        "BspLedManager.h",
        "DarwinLedManager.h",
        "ElbertLedManager.h",
        "FsdbSwitchStateSubscriber.h",
        "FujiLedManager.h",
        "Icecube800bcLedManager.h",
        "Icetea800bcLedManager.h",
        "Janga800bicLedManager.h",
        "Ladakh800bclsLedManager.h",
        "LedManager.h",
        "LedManagerInit.h",
        "Meru800bfaLedManager.h",
        "Meru800biaLedManager.h",
        "Minipack3NLedManager.h",
        "MinipackBaseLedManager.h",
        "MinipackLedManager.h",
        "MontblancLedManager.h",
        "Morgan800ccLedManager.h",
        "Tahan800bcLedManager.h",
        "Tahansb800bcLedManager.h",
        "Wedge400BaseLedManager.h",
        "Wedge400CLedManager.h",
        "Wedge400LedManager.h",
        "Wedge800BACTLedManager.h",
        "YampLedManager.h",
    ],
    exported_deps = [
        ":led-config",
        ":led_utils",
        "//fboss/agent:enum_utils",
        "//fboss/agent:fboss-error",
        "//fboss/agent:switch_state-cpp2-types",
        "//fboss/agent/if:ctrl-cpp2-types",
        "//fboss/agent/platforms/common:platform_mapping",
        "//fboss/agent/platforms/common/darwin:darwin_platform_mapping",
        "//fboss/agent/platforms/common/elbert:elbert_platform_mapping",
        "//fboss/agent/platforms/common/fuji:fuji_platform_mapping",
        "//fboss/agent/platforms/common/icecube800bc:icecube800bc_platform_mapping",
        "//fboss/agent/platforms/common/icetea800bc:icetea800bc_platform_mapping",
        "//fboss/agent/platforms/common/janga800bic:janga800bic_platform_mapping",
        "//fboss/agent/platforms/common/ladakh800bcls:ladakh800bcls_platform_mapping",
        "//fboss/agent/platforms/common/meru800bfa:meru800bfa_platform_mapping",
        "//fboss/agent/platforms/common/meru800bia:meru800bia_platform_mapping",
        "//fboss/agent/platforms/common/minipack:minipack_platform_mapping",
        "//fboss/agent/platforms/common/minipack3n:minipack3n_platform_mapping",
        "//fboss/agent/platforms/common/montblanc:montblanc_platform_mapping",
        "//fboss/agent/platforms/common/morgan800cc:morgan800cc_platform_mapping",
        "//fboss/agent/platforms/common/tahan800bc:tahan800bc_platform_mapping",
        "//fboss/agent/platforms/common/tahansb800bc:tahansb800bc_platform_mapping",
        "//fboss/agent/platforms/common/wedge400:wedge400_platform_mapping",
        "//fboss/agent/platforms/common/wedge400c:wedge400c_platform_mapping",
        "//fboss/agent/platforms/common/wedge800bact:wedge800bact_platform_mapping",
        "//fboss/agent/platforms/common/yamp:yamp_platform_mapping",
        "//fboss/fsdb/client:fsdb_pub_sub",
        "//fboss/fsdb/client:fsdb_stream_client",
        "//fboss/fsdb/if:fsdb_model",
        "//fboss/fsdb/if:fsdb_oper-cpp2-types",
        "//fboss/lib:common_file_utils",
        "//fboss/lib:common_port_utils",
        "//fboss/lib/bsp:bsp_core",
        "//fboss/lib/bsp/icecube800bc:icecube800bc_bsp",
        "//fboss/lib/bsp/icetea800bc:icetea800bc_bsp",
        "//fboss/lib/bsp/janga800bic:janga800bic_bsp",
        "//fboss/lib/bsp/ladakh800bcls:ladakh800bcls_bsp",
        "//fboss/lib/bsp/meru800bfa:meru800bfa_bsp",
        "//fboss/lib/bsp/meru800bia:meru800bia_bsp",
        "//fboss/lib/bsp/minipack3n:minipack3n_bsp",
        "//fboss/lib/bsp/montblanc:montblanc_bsp",
        "//fboss/lib/bsp/morgan800cc:morgan800cc_bsp",
        "//fboss/lib/bsp/tahan800bc:tahan800bc_bsp",
        "//fboss/lib/bsp/tahansb800bc:tahansb800bc_bsp",
        "//fboss/lib/bsp/wedge800bact:wedge800bact_bsp",
        "//fboss/lib/fpga:minipack_base_container",
        "//fboss/lib/fpga:minipack_container",
        "//fboss/lib/fpga:wedge400_fpga",
        "//fboss/lib/fpga/facebook/darwin:darwin_fpga",
        "//fboss/lib/fpga/facebook/elbert:elbert_fpga",
        "//fboss/lib/fpga/facebook/fuji:fuji_container",
        "//fboss/lib/fpga/facebook/yamp:yamp_base_fpga",
        "//fboss/lib/fpga/facebook/yamp:yamp_fpga",
        "//fboss/lib/led:led_lib",
        "//fboss/lib/led:led_mapping-cpp2-types",
        "//fboss/lib/platforms:product-info",
        "//folly:format",
        "//folly:synchronized",
        "//folly/io/async:async_base",
        "//folly/logging:logging",
        "//thrift/lib/cpp2/protocol:protocol",
    ],
)

cpp_binary(
    name = "led_service",
    srcs = [
        "Main.cpp",
    ],
    headers = [],
    deps = [
        ":led_core",
        ":led_utils",
        "//fb303:logging",
        "//fboss/platform/helpers:init",
        "//folly/logging:init",
        "//folly/logging:logging",
    ],
    external_deps = [
        "gflags",
    ],
)

cpp_library(
    name = "led-config",
    srcs = [
        "LedConfig.cpp",
    ],
    headers = [
        "LedConfig.h",
    ],
    exported_deps = [
        "//fboss/agent:fboss-error",
        "//fboss/led_service/if:config-cpp2-types",
        "//folly:file_util",
        "//folly/logging:logging",
        "//thrift/lib/cpp2/protocol:protocol",
    ],
)
